import java.io.*;
import java.util.Stack;

public class HJ50 {
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        str = str.replace("[","("); // 将括号统一为小括号
        str = str.replace("]",")");
        str = str.replace("{","(");
        str = str.replace("}",")");
        //System.out.println(solve(str));
    }

    /*
        递归思想，从内到外处理括号，用栈存放操作数和中间结果。
      +运算符直接入栈，-运算符乘-1入栈，乘除运算符计算完入栈，
      最终栈内所有数相加即是结果
    */
    /*public static int solve(String s) {
       Stack<Integer> stack = new Stack<>();
        char[] chars = s.toCharArray();
        int index = 0;
        char fuhao = '+';
        int number = 0;
        for (int i = 0; i < s.length(); i++) {
            char ch = chars[i];
            if(ch == ' ')
                continue;
            if(Character.isDigit(ch)){
                number = number*10 + ch - '0';
            }
            if(ch == '('){
                int j = i + 1;
                int count = 1;
                while (count>0){
                    if(chars[j] == ')')
                        count--;
                    if(chars[j] == '(')
                        count++;
                    j++;
                }
                number = solve(s.substring(i+1,j-1));
                i = j-1;
            }
        }
    }*/

}
